﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Honestysoft.BaseObject;
using Honestysoft.Baseframework.WebUI;
using System.Data;
using Honestysoft.Financing.Model;

namespace Honestysoft.Financing.WebUI.Module.Audit
{
    public partial class SelectOpinion : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        private void Bind()
        {
            QueryParameters query = new QueryParameters();
            query.Add("UserID", UserLoginer.LoginUser.ID, QueryParameters.OperatorType.Equal);
            if (txtOpinion.Text.Trim().Length > 0)
            {
                query.Add("Opinion", txtOpinion.Text.Trim(), QueryParameters.OperatorType.Like);
            }
            OrderParameters order = new OrderParameters();
            order.Add("Opinion");
            DataTable dt = new BaseBusinessLogic<Bu_UserOpinion>(Globals.CurrentConnStringName).GetTable(query, order);
            rptList.DataSource = dt;
            rptList.DataBind();
        }

        protected string GetUrl(string text)
        {
            //title=\"" + text + "\"
            string a = "<a href=\"#\" title=\""+text+"\"  onclick=\"javascript:getReturn('" + text + "');\">";
            if (text.Length < 100)
            {
                a += text;
            }
            else
            {
                a += text.Substring(0, 100) + "...";
            }
            a += "</a>";
            return a;
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            Bind();
        }
    }
}